package com.twu.biblioteca;

public class MembershipController implements Option {

    @Override
    public String getServiceDescription() {
        return "Check membership details";
    }

    @Override
    public String supplyService() {

        LoginController loginController = new LoginController();
        return showMembership(loginController.checkLogin());
    }

    private String showMembership(boolean loginStatus) {
        String result = "";
        if (loginStatus) {
            String separator = System.getProperty("line.separator");
            result = result + "Welcome dear membership!" + separator +
                    "Your name is: " + BibliotecaApp.legalUser.getName() + separator +
                    "Your email is: " + BibliotecaApp.legalUser.getEmail() + separator +
                    "Your phone number is: " + BibliotecaApp.legalUser.getPhoneNumber() + separator;
        } else {
            result = "Please talk to a Librarian. Thank you.";
        }
        return result;
    }
}
